<?php

namespace App\Http\Controllers\Admin;

use Auth;
use Illuminate\Http\Request;


class HomeController extends Controller
{
    public function __construct()
    {
        $this->middleware('admin.auth');
    }

    /**
     * 后台首页
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function index(Request $request)
    {
        if ($request->isMethod('post')) {
            $user = auth('admin')->user();
            $permissions = $user->myPermissions()->get();
            return compact('user', 'permissions');
        }

        return view('admin.index');
    }


}